package com.zpark.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @PackageName: com.zpark
 * @ClassName: ProviderNacosController
 * @Description:
 * @author: RZS
 * @date: 2024/4/23  11:44
 */
@RestController
@RequestMapping("/provider")
public class ProviderNacosController {

    @Value("${server.port}")
    private Integer port;

    // 所有请求方式都可以访问
    @RequestMapping("/test")
    public String test(HttpServletRequest request){
        // 从请求头当中获取指定的数据
        String color = request.getHeader("X-Request-red");
        // 获取请求参数
        String key = request.getParameter("key");
        return "服务远程调用成功" + port + ", " + color + ", " + key;
    }
}
